home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / tcekbd.arc / BIOSKEYE.C next >
Text File  |  1990-10-21  |  2KB  |  40 lines

  1. #include <dos.h>
  2. #include "bioskeye.h"
  3.  
  4. int bioskeye(function)
  5. int function;
  6. {
  7.  
  8.    static union REGS rg;                          /* define registers */
  9.    int rc;                                      /* define return code */
  10.  
  11.    switch (function) {             /* check which function asking for */
  12.       /* --------------------------------function 0: return key value */
  13.       case 0:
  14.          rg.h.ah = 0x10;                    /* interrupt function 10h */
  15.          int86(0x16, &rg, &rg);                 /* call interrupt 16h */
  16.          rc = rg.x.ax;             /* 'AH'=Scan Code, 'AL'=ASCII code */
  17.          break;                                     /* get outta here */
  18.       /* ------------------function 1: report key stroke availability */
  19.       case 1:
  20.          rg.h.ah = 0x11;                    /* interrupt function 11h */
  21.          int86(0x16, &rg, &rg);                 /* call interrupt 16h */
  22.          if (rg.x.flags & 0x40)                   /* check status bit */
  23.             rc = 0;               /* bit set, report no key available */
  24.          else
  25.             rc = rg.x.ax;          /* bit clear, report key available */
  26.          break;                                     /* get outta here */
  27.       /* -----------------------------function 1: report shift status */
  28.       case 2:
  29.          rg.h.ah = 0x12;                    /* interrupt function 12h */
  30.          int86(0x16, &rg, &rg);                 /* call interrupt 16h */
  31.          rc = rg.x.ax;                           /* 'AX'=Shift Status */
  32.          break;                                     /* get outta here */
  33.       /* --------------------------what function ???, return 0 anyway */
  34.       default:
  35.          rc = 0;
  36.          break;                                     /* get outta here */
  37.    }
  38.    return rc;                                    /* all done, bye bye */
  39. }
  40.